home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / BPNN133U.ZIP / TIMER.C < prev    next >
C/C++ Source or Header  |  1992-11-19  |  523b  |  30 lines

  1. /*
  2. *-----------------------------------------------------------------------------
  3. *    file:    timer.c
  4. *    desc:    time a program in secs
  5. *    by:    patrick ko
  6. *    date:    18 jan 92
  7. *-----------------------------------------------------------------------------
  8. */
  9.  
  10. #include <stdio.h>
  11. #include <time.h>
  12.  
  13. static time_t    last;
  14. static time_t    this;
  15. static time_t    temp;
  16.  
  17. void timer_restart( )
  18. {
  19.     time( &last );
  20. }
  21.  
  22. long int timer_stop( )
  23. {
  24.     time( &this );
  25.     temp = this - last;
  26.     last = this;
  27.  
  28.     return ((long int)temp);
  29. }
  30.